home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / DriverGestalt.p < prev    next >
Text File  |  1996-05-01  |  15KB  |  364 lines

  1. {
  2.      File:        DriverGestalt.p
  3.  
  4.      Contains:    Driver Gestalt interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT DriverGestalt;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __DRIVERGESTALT__}
  28. {$SETC __DRIVERGESTALT__ := 1}
  29.  
  30. {$I+}
  31. {$SETC DriverGestaltIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __OSUTILS__}
  38. {$I OSUtils.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __SCSI__}
  41. {$I SCSI.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. {$IFC FOR_SYSTEM7_ONLY }
  49. { __________________________________________________________________________________ }
  50. {  The Driver Gestalt bit in the dCtlFlags  }
  51.  
  52. CONST
  53.     kbDriverGestaltEnable        = 2;
  54.     kmDriverGestaltEnableMask    = $04;
  55.  
  56. { __________________________________________________________________________________ }
  57. {  Driver Gestalt related csCodes  }
  58.     kDriverGestaltCode            = 43;                            {  various uses  }
  59.     kDriverConfigureCode        = 43;                            {  various uses  }
  60.     kdgLowPowerMode                = 70;                            {  Sets/Returns the current energy consumption level  }
  61.     kdgReturnDeviceID            = 120;                            {  returns SCSI DevID in csParam[0]  }
  62.     kdgGetCDDeviceInfo            = 121;                            {  returns CDDeviceCharacteristics in csParam[0]  }
  63.  
  64. { __________________________________________________________________________________ }
  65. {  Driver Gestalt selectors  }
  66.     kdgVersion                    = 'vers';                        {  Version number of the driver in standard Apple format  }
  67.     kdgDeviceType                = 'devt';                        {  The type of device the driver is driving.  }
  68.     kdgInterface                = 'intf';                        {  The underlying interface that the driver is using (if any)  }
  69.     kdgSync                        = 'sync';                        {  True if driver only behaves synchronously.  }
  70.     kdgBoot                        = 'boot';                        {  value to place in PRAM for this drive (long)  }
  71.     kdgWide                        = 'wide';                        {  True if driver supports ioWPosOffset  }
  72.     kdgPurge                    = 'purg';                        {  Driver purge permission (True = purge; False = no purge)  }
  73.     kdgSupportsSwitching        = 'lpwr';                        {  True if driver supports power switching  }
  74.     kdgMin3VPower                = 'pmn3';                        {  Minimum 3.3V power consumption in microWatts  }
  75.     kdgMin5VPower                = 'pmn5';                        {  Minimum 5V power consumption in microWatts  }
  76.     kdgMax3VPower                = 'pmx3';                        {  Maximum 3.3V power consumption in microWatts  }
  77.     kdgMax5VPower                = 'pmx5';                        {  Maximum 5V power consumption in microWatts  }
  78.     kdgInHighPower                = 'psta';                        {  True if device is currently in high power mode  }
  79.     kdgSupportsPowerCtl            = 'psup';                        {  True if driver supports following five calls  }
  80.     kdgAPI                        = 'dAPI';                        {  API support for PC Exchange  }
  81.     kdgEject                    = 'ejec';                        {  Eject options for shutdown/restart <2/03/95>  }
  82.  
  83. { __________________________________________________________________________________ }
  84. {  status parameter block for Driver Gestalt calls  }
  85.  
  86. TYPE
  87.     DriverGestaltParamPtr = ^DriverGestaltParam;
  88.     DriverGestaltParam = RECORD
  89.         qLink:                    QElemPtr;
  90.         qType:                    INTEGER;
  91.         ioTrap:                    INTEGER;
  92.         ioCmdAddr:                Ptr;
  93.         ioCompletion:            ProcPtr;
  94.         ioResult:                OSErr;
  95.         ioNamePtr:                StringPtr;
  96.         ioVRefNum:                INTEGER;
  97.         ioCRefNum:                INTEGER;                                {  refNum for I/O operation  }
  98.         csCode:                    INTEGER;                                {     == kDriverGestaltCode  }
  99.         driverGestaltSelector:    OSType;                                    {  'sync', 'vers', etc.  }
  100.         driverGestaltResponse:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  101.         driverGestaltResponse1:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  102.         driverGestaltResponse2:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  103.         driverGestaltResponse3:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  104.         driverGestaltfiller:    UInt16;                                    {  To pad out to the size of a controlPB  }
  105.     END;
  106.  
  107. {
  108.  Note that the various response definitions are overlays of the response fields above.
  109.    For instance the deviceType response would be returned in driverGestaltResponse.
  110.    The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
  111. }
  112. { __________________________________________________________________________________ }
  113. {  Device Types response  }
  114.     DriverGestaltDevTResponsePtr = ^DriverGestaltDevTResponse;
  115.     DriverGestaltDevTResponse = RECORD
  116.         deviceType:                OSType;
  117.     END;
  118.  
  119.  
  120. CONST
  121.     kdgDiskType                    = 'disk';                        {  standard r/w disk drive  }
  122.     kdgTapeType                    = 'tape';                        {  tape drive  }
  123.     kdgPrinterType                = 'prnt';                        {  printer  }
  124.     kdgProcessorType            = 'proc';                        {  processor  }
  125.     kdgWormType                    = 'worm';                        {  write-once  }
  126.     kdgCDType                    = 'cdrm';                        {  cd-rom drive  }
  127.     kdgFloppyType                = 'flop';                        {  floppy disk drive  }
  128.     kdgScannerType                = 'scan';                        {  scanner  }
  129.     kdgFileType                    = 'file';                        {  Logical Partition type based on a file (Drive Container)  }
  130.     kdgRemovableType            = 'rdsk';                        {  A removable media hard disk drive ie. Syquest, Bernioulli  }
  131.  
  132. { __________________________________________________________________________________ }
  133. {  Device Interfaces response  }
  134.  
  135. TYPE
  136.     DriverGestaltIntfResponsePtr = ^DriverGestaltIntfResponse;
  137.     DriverGestaltIntfResponse = RECORD
  138.         interfaceType:            OSType;
  139.     END;
  140.  
  141.  
  142. CONST
  143.     kdgScsiIntf                    = 'scsi';
  144.     kdgPcmciaIntf                = 'pcmc';
  145.     kdgATAIntf                    = 'ata ';
  146.     kdgFireWireIntf                = 'fire';
  147.     kdgExtBus                    = 'card';
  148.  
  149. { __________________________________________________________________________________ }
  150. {  Power Saving  }
  151.  
  152. TYPE
  153.     DriverGestaltPowerResponsePtr = ^DriverGestaltPowerResponse;
  154.     DriverGestaltPowerResponse = RECORD
  155.         powerValue:                LONGINT;                                {  Power consumed in µWatts  }
  156.     END;
  157.  
  158. { __________________________________________________________________________________ }
  159. {  Disk Specific  }
  160.     DriverGestaltSyncResponsePtr = ^DriverGestaltSyncResponse;
  161.     DriverGestaltSyncResponse = RECORD
  162.         behavesSynchronously:    BOOLEAN;
  163.         pad:                    PACKED ARRAY [0..2] OF UInt8;
  164.     END;
  165.  
  166.     DriverGestaltBootResponsePtr = ^DriverGestaltBootResponse;
  167.     DriverGestaltBootResponse = RECORD
  168.         extDev:                    SInt8;                                    {   Packed target (upper 5 bits) LUN (lower 3 bits)  }
  169.         partition:                SInt8;                                    {   Unused  }
  170.         SIMSlot:                SInt8;                                    {   Slot  }
  171.         SIMsRSRC:                SInt8;                                    {   sRsrcID  }
  172.     END;
  173.  
  174.     DriverGestaltAPIResponsePtr = ^DriverGestaltAPIResponse;
  175.     DriverGestaltAPIResponse = RECORD
  176.         partitionCmds:            INTEGER;                                {  if bit 0 is nonzero, supports partition control and status calls  }
  177.                                                                         {          prohibitMounting (control, kProhibitMounting)  }
  178.                                                                         {          partitionToVRef (status, kGetPartitionStatus)  }
  179.                                                                         {          getPartitionInfo (status, kGetPartInfo)  }
  180.         unused1:                INTEGER;                                {  all the unused fields should be zero  }
  181.         unused2:                INTEGER;
  182.         unused3:                INTEGER;
  183.         unused4:                INTEGER;
  184.         unused5:                INTEGER;
  185.         unused6:                INTEGER;
  186.         unused7:                INTEGER;
  187.         unused8:                INTEGER;
  188.         unused9:                INTEGER;
  189.         unused10:                INTEGER;
  190.     END;
  191.  
  192. {  Flags for purge permissions  }
  193.  
  194. CONST
  195.     kbCloseOk                    = 0;                            {  Ok to call Close  }
  196.     kbRemoveOk                    = 1;                            {  Ok to call RemoveDrvr  }
  197.     kbPurgeOk                    = 2;                            {  Ok to call DisposePtr  }
  198.     kmNoCloseNoPurge            = 0;
  199.     kmOkCloseNoPurge            = $03;
  200.     kmOkCloseOkPurge            = $07;
  201.  
  202. {  Driver purge permission structure  }
  203.  
  204. TYPE
  205.     DriverGestaltPurgeResponsePtr = ^DriverGestaltPurgeResponse;
  206.     DriverGestaltPurgeResponse = RECORD
  207.         purgePermission:        UInt16;                                    {  0 = Do not change the state of the driver  }
  208.                                                                         {  3 = Do Close() and DrvrRemove() this driver  }
  209.                                                                         {  but don't deallocate driver code  }
  210.                                                                         {  7 = Do Close(), DrvrRemove(), and DisposePtr()  }
  211.         purgeReserved:            UInt16;
  212.         purgeDriverPointer:        Ptr;                                    {  pointer to the start of the driver block (valid  }
  213.                                                                         {  only of DisposePtr permission is given  }
  214.     END;
  215.  
  216.     DriverGestaltEjectResponsePtr = ^DriverGestaltEjectResponse;
  217.     DriverGestaltEjectResponse = RECORD
  218.         ejectFeatures:            UInt32;                                    {    }
  219.     END;
  220.  
  221. {  Flags for Ejection Features field  }
  222.  
  223. CONST
  224.     kRestartDontEject            = 0;                            {  Dont Want eject during Restart  }
  225.     kShutDownDontEject            = 1;                            {  Dont Want eject during Shutdown  }
  226.     kRestartDontEject_Mask        = $01;
  227.     kShutDownDontEject_Mask        = $02;
  228.  
  229. { __________________________________________________________________________________ }
  230. {  CD-ROM Specific  }
  231. {
  232.  The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a 
  233.    standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
  234. }
  235.  
  236. TYPE
  237.     CDDeviceCharacteristicsPtr = ^CDDeviceCharacteristics;
  238.     CDDeviceCharacteristics = RECORD
  239.         speedMajor:                SInt8;                                    {  High byte of fixed point number containing drive speed  }
  240.         speedMinor:                SInt8;                                    {  Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc.  }
  241.         cdFeatures:                UInt16;                                    {  Flags field for features and transport type of this CD-ROM  }
  242.     END;
  243.  
  244.  
  245. CONST
  246.     cdFeatureFlagsMask            = $FFFC;                        {  The Flags are in the first 14 bits of the cdFeatures field  }
  247.     cdTransportMask                = $0003;                        {  The transport type is in the last 2 bits of the cdFeatures field  }
  248.  
  249. {  Flags for CD Features field  }
  250.     cdMute                        = 0;                            {  The following flags have the same bit number  }
  251.     cdLeftToChannel                = 1;                            {  as the Audio Mode they represent.  Don't change  }
  252.     cdRightToChannel            = 2;                            {  them without changing dControl.c  }
  253.     cdLeftPlusRight                = 3;                            {  Reserve some space for new audio mixing features (4-7)  }
  254.     cdSCSI_2                    = 8;                            {  Supports SCSI2 CD Command Set  }
  255.     cdStereoVolume                = 9;                            {  Can support two different volumes (1 on each channel)  }
  256.     cdDisconnect                = 10;                            {  Drive supports disconnect/reconnect  }
  257.     cdWriteOnce                    = 11;                            {  Drive is a write/once (CD-R?) type drive  }
  258.     cdMute_Mask                    = $01;
  259.     cdLeftToChannel_Mask        = $02;
  260.     cdRightToChannel_Mask        = $04;
  261.     cdLeftPlusRight_Mask        = $08;
  262.     cdSCSI_2_Mask                = $0100;
  263.     cdStereoVolume_Mask            = $0200;
  264.     cdDisconnect_Mask            = $0400;
  265.     cdWriteOnce_Mask            = $0800;
  266.  
  267. {  Transport types  }
  268.     cdCaddy                        = 0;                            {  CD_SC,CD_SC_PLUS,CD-300 etc.  }
  269.     cdTray                        = 1;                            {  CD_300_PLUS etc.  }
  270.     cdLid                        = 2;                            {  Power CD - eg no eject mechanism  }
  271.  
  272. {
  273.  the following are used by PC Exchange (and houdini)
  274.  Control Codes
  275. }
  276.     kRegisterPartition            = 50;                            {  PCX needs a new Drive (for a non-macintosh partition found on the disk) }
  277.     OLD_REGISTER_PARTITION        = 301;                            {  left in for compatibility with shipping Houdini }
  278.     THE_DRIVE                    = 0;                            {  DrvQElPtr for the partition to register }
  279.     THE_PHYS_START                = 1;                            {  The start of the partition in logical blocks }
  280.     THE_PHYS_SIZE                = 2;                            {  The size of the partition in logical blocks }
  281.     kGetADrive                    = 51;                            {  control call to ask the driver to create a drive }
  282.     OLD_GET_A_DRIVE                = 302;                            {  left in for compatibility with shipping Houdini }
  283.     THE_VAR_QUEL                = 0;                            {  a VAR parameter for the returned DrvQElPtr }
  284.     kProhibitMounting            = 52;                            {  Dont allow mounting of the following drives }
  285.     kOldProhibitMounting        = 2100;                            {  left in for compatibility with shipping Houdini }
  286.     kProhibitDevice                = 0;                            {  CS Param 0 and 1 (partInfoRecPtr) }
  287.     kIsContainerMounted            = 53;
  288.     kOldIsContainerMounted        = 2201;                            {  left in for compatibility with shipping Houdini             }
  289.     kContainerVRef                = 0;                            {  CS Param 0 and 1 (VRefNum) }
  290.     kContainerParID                = 1;                            {  CS Param 2 and 3 (Parent ID) }
  291.     kContainerName                = 2;                            {  CS Param 4 and 5 (File Name) }
  292.     kContainerResponse            = 3;                            {  CS Param 6 and 7 (VAR pointer to short result) }
  293.     kMountVolumeImg                = 54;
  294.     OLD_MOUNT_VOLUME_IMG        = 2000;
  295.     MV_HOST_VREFNUM                = 0;
  296.     MV_HOST_PAR_ID                = 1;
  297.     MV_HOST_NAME                = 2;
  298.     MV_REQ_PERM                    = 3;
  299.  
  300. {  Status Codes }
  301.     kGetPartitionStatus            = 50;                            {  what is the status of this partition? }
  302.     kOldGetPartitionStatus        = 2200;                            {  left in for compatibility with shipping Houdini }
  303.     kDeviceToQuery                = 0;                            {  CS Param 0 and 1 (partInfoRecPtr) }
  304.     kDeviceResponse                = 1;                            {  CS Param 2 and 3 (VAR pointer to short result) }
  305.     kGetPartInfo                = 51;                            {  Get a partition info record based on the provided vrefnum }
  306.     kOldGetPartInfo                = 2300;                            {  left in for compatibility with shipping Houdini }
  307.     kPartInfoResponse            = 0;                            {  var parameter (pointer to partInfoRec) CSParam [0-1] }
  308.     kGetContainerAlias            = 52;                            {  Get the alias that describes the file this drive was mounted from. }
  309.     kOldGetContainerAlias        = 2400;                            {  left in for compatibility with shipping Houdini }
  310.     kGetAliasResponse            = 0;                            {     var parameter (pointer to a Handle) CSParam [0-1] }
  311.  
  312. {  the result codes to come from the driver interface  }
  313.     DRIVER_NOT_INSTALLED        = -1;
  314.     DRIVER_BUSY                    = -2;
  315.     CANT_MOUNT_WITHIN_THIS_FS    = -3;                            {  can only mount container within residing on HFS volume }
  316.     VOLUME_ALREADY_MOUNTED        = -4;                            {  Already Mounted }
  317.  
  318. {  requisite structures for PCX control and status calls }
  319.     kMaxProhibted                = 2;                            {  the max number of volumes the PC can possibly have mounted }
  320.  
  321. {  GestaltSelector for Finding Driver information }
  322.     kGetDriverInfo                = 'vdrc';
  323.  
  324.     VerifyCmd                    = 5;
  325.     FormatCmd                    = 6;
  326.     EjectCmd                    = 7;
  327.  
  328. {  Partition information passed back and forth between PCX and the driver }
  329.  
  330. TYPE
  331.     partInfoRecPtr = ^partInfoRec;
  332.     partInfoRec = RECORD
  333.         SCSIID:                    DeviceIdent;                            {  DeviceIdent for the device }
  334.         physPartitionLoc:        UInt32;                                    {  physical block number of beginning of partition }
  335.         partitionNumber:        UInt32;                                    {  the partition number of this partition }
  336.     END;
  337.  
  338.     vPartInfoRecPtr = ^vPartInfoRec;
  339.     vPartInfoRec = RECORD
  340.         VPRTVers:                SInt8;                                    {  Virtual partition version number }
  341.         VPRTType:                SInt8;                                    {  virtual partition type (DOS, HFS, etc) }
  342.         drvrRefNum:                SInt16;                                    {  Driver Reference number of partition driver }
  343.     END;
  344.  
  345. {  Information related to DOS partitions }
  346.  
  347. CONST
  348.     kDOSSigLow                    = $01FE;                        {  offset into boot block for DOS signature }
  349.     kDOSSigHi                    = $01FF;                        {  offset into boot block for DOS signature }
  350.     kDOSSigValLo                = $55;                            {  DOS signature value in low byte }
  351.     kDOSSigValHi                = $AA;                            {  DOS signature value in high byte }
  352.  
  353. {$ENDC}
  354. {$ALIGN RESET}
  355. {$POP}
  356.  
  357. {$SETC UsingIncludes := DriverGestaltIncludes}
  358.  
  359. {$ENDC} {__DRIVERGESTALT__}
  360.  
  361. {$IFC NOT UsingIncludes}
  362.  END.
  363. {$ENDC}
  364.